<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!--********************************************************************
* 该示例需要引入 
* G6 (https://github.com/antvis/G6)
*********************************************************************-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <title data-i18n="resources.title_l7_path_arrow"></title>
    <script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
    <style>
      body {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100vh;
        overflow: hidden;
      }
      #map {
        width: 100%;
        height: 100%;
      }
    </style>
  </head>

  <body>
    <div id="map"></div>
    <script type="text/javascript" include="mapbox-gl-enhance,L7,g2" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
    <script type="text/javascript">
      var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
      var attribution =
        "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
        " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
        " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";

      var map = new mapboxgl.Map({
        container: 'map',
        style: {
          version: 8,
          sources: {
            'raster-tiles': {
              attribution: attribution,
              type: 'raster',
              tiles: [
                host +
                  '/iserver/services/map-china/rest/maps/China/zxyTileImage.png?prjCoordSys=' +
                  encodeURIComponent('{"epsgCode":3857}') +
                  '&z={z}&x={x}&y={y}'
              ],
              tileSize: 256
            }
          },
          layers: [
            {
              id: 'simple-tiles',
              type: 'raster',
              source: 'raster-tiles',
              minzoom: 0,
              maxzoom: 22
            }
          ]
        },
        center: [120.15, 30.3],
        zoom: 10
      });

      map.on('load', function () {
        var pointLayer = new mapboxgl.supermap.L7Layer({ type: 'PointLayer' });
        pointLayer
          .getL7Layer()
          .source([{ lng: 120.155, lat: 30.31 }], {
            parser: {
              type: 'json',
              x: 'lng',
              y: 'lat'
            }
          })
          .shape('circle')
          .size(6000)
          .color('#f00')
          .animate(true)
          .style({
            unit: 'meter'
          });
        map.addLayer(pointLayer);
        var linelayer = new mapboxgl.supermap.L7Layer({ type: 'LineLayer' });
        linelayer
          .getL7Layer()
          .source({
            type: 'FeatureCollection',
            features: [
              {
                type: 'Feature',
                properties: {},
                geometry: {
                  type: 'LineString',
                  coordinates: [
                    [120.1863098144, 30.321915039121],
                    [120.3401184082, 30.43446594614]
                  ]
                }
              },
              {
                type: 'Feature',
                properties: {},
                geometry: {
                  type: 'LineString',
                  coordinates: [
                    [120.19660949707033, 30.298796461361665],
                    [120.31883239746092, 30.28041626667403]
                  ]
                }
              },
              {
                type: 'Feature',
                properties: {},
                geometry: {
                  type: 'LineString',
                  coordinates: [
                    [120.12245178222656, 30.29523927312319],
                    [120.01808166503906, 30.261439550638762]
                  ]
                }
              },
              {
                type: 'Feature',
                properties: {},
                geometry: {
                  type: 'LineString',
                  coordinates: [
                    [120.15609741210938, 30.285159872426014],
                    [120.14923095703124, 30.20626765511821]
                  ]
                }
              },
              {
                type: 'Feature',
                properties: {},
                geometry: {
                  type: 'LineString',
                  coordinates: [
                    [120.10940551757812, 30.320136880604423],
                    [120.01327514648438, 30.362803774813028]
                  ]
                }
              }
            ]
          })
          .size(2)
          .shape('line')
          .style({
            arrow: {
              enable: true,
              arrowWidth: 4,
              arrowHeight: 4,
              tailWidth: 0.4
            }
          })
          .color('#f00');
        map.addLayer(linelayer);
      });
    </script>
  </body>
</html>
